import { cloneDeep, isObject } from 'lodash';

//深度合并
export function deepMerge<T = any>(source: any = {}, target: any = {}): T {
  let key: string;
  const res: any = cloneDeep(source);
  for (key in target) {
    res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : target[key];
  }
  return res;
}
